chcp 65001

@echo off
set OUTPUT_DIR=publish
set ZIP_FILE=WebDavSyncTool.zip

echo 清理发布目录...
if exist %OUTPUT_DIR% rd /s /q %OUTPUT_DIR%
mkdir %OUTPUT_DIR%

echo 编译发布版本...
call .\build.bat

echo 复制必要文件...
xcopy /y /i bin\Release\rclone\rclone.exe %OUTPUT_DIR%\rclone\
xcopy /y /i bin\Release\rclone\x86\rclone.exe %OUTPUT_DIR%\rclone\x86\
copy /y bin\Release\WebDavSyncTool.exe %OUTPUT_DIR%\
copy /y App.config %OUTPUT_DIR%\WebDavSyncTool.exe.config
copy /y install_scripts\install.bat %OUTPUT_DIR%\
copy /y install_scripts\uninstall.bat %OUTPUT_DIR%\

echo 打包为zip文件...
powershell -Command "Compress-Archive -Path %OUTPUT_DIR%\* -DestinationPath %OUTPUT_DIR%\%ZIP_FILE%"

echo 发布完成！
echo 生成的zip文件：%OUTPUT_DIR%\%ZIP_FILE%
pause